package exp1st;

import java.io.*;
import java.util.Scanner;
import java.util.StringTokenizer;

public class linked<T> {
    public static void main(String[] args) throws IOException {
        LinearNodeList lnl = new LinearNodeList();
        Scanner scan = new Scanner(System.in);
        String num;
        int nZhaoQianChen = 0;

        System.out.println("输入学号和时间:");
        num = scan.nextLine();

        StringTokenizer st1 = new StringTokenizer(num, " ");

        while (st1.hasMoreElements()) {
            lnl.add(st1.nextToken());
            nZhaoQianChen++;
        }

        System.out.println(lnl.toString());
        System.out.println("元素个数：" + nZhaoQianChen);

        File file = new File("D:\\numbers.txt");
        BufferedReader br = new BufferedReader(new FileReader(file));

        lnl.insert(5, br.readLine());
        nZhaoQianChen++;
        System.out.println(lnl);

        lnl.insert(0, br.readLine());
        nZhaoQianChen++;
        System.out.println(lnl);
        lnl.delete(6);//插入“2”后，“1”的索引为6
        nZhaoQianChen--;
        System.out.println(lnl);
        System.out.println("元素个数：" + lnl.size() + "\n");

        //-------------------sort----------------------
        lnl.selectionSort();


    }
}
